# import time
# from selenium import webdriver
# from selenium.webdriver.common.by import By
# # 创建浏览器驱动
# driver = webdriver.Chrome()
# # 获取访问页面
# driver.get("http://121.43.169.97:8848/pageA.html")
# # 放大浏览器
# driver.maximize_window()
# # 模拟用户操作
# driver.find_element(By.XPATH,"//input[@name='userA']").send_keys("admin")
# driver.find_element(By.XPATH,"//*[@id='passwordA']").send_keys("123456")
# # 属性和逻辑结合
# driver.find_element(By.XPATH,"//*[@type='button' and @value='prompt']").click()
# # 等待3秒
# time.sleep(3)
# # 退出浏览器

# # 1.导包（快捷键：alt + enter）
# import time
# from selenium import webdriver
# from selenium.webdriver.common.by import By
# from selenium.webdriver.chrome.service import Service
# # 2.打开浏览器（创建浏览器驱动对象）
# path = r"D:\tools\drivers\chromedriver.exe" # 定义驱动路径
# ser = Service(executable_path=path) # 实例化Chrome浏览器服务驱动
# driver = webdriver.Chrome(service=ser) # 打开Chrome浏览器
# # 3.输入网址
# driver.get("http://121.43.169.97:8848/pageA.html")
# # 4.页面操作：层级与属性定位
# # 用户名
# driver.find_element(By.XPATH,"//p[@id='pa']/input[@type='text']").send_keys("admin")
# # 密码
# driver.find_element(By.XPATH,"//p/input[@type='password']").send_keys("123456")
# # 5.等待2秒
# time.sleep(2)


# import time
# from selenium import webdriver
# from selenium.webdriver.common.by import By
# from selenium.webdriver.chrome.service import Service
# # 2.打开浏览器（创建浏览器驱动对象）
# path = r"D:\tools\drivers\chromedriver.exe" # 定义驱动路径
# ser = Service(executable_path=path) # 实例化Chrome浏览器服务驱动
# driver = webdriver.Chrome() # 打开Chrome浏览器
# # 3.输入网址
# driver.get("http://121.43.169.97:8848/pageA.html")
#
# # 4.页面操作:定位百度按钮
# driver.find_element(by=By.XPATH, value="//*[text()='百度']").click()
# # 路径+文本：//*[text()="文本信息"]
# # 5.等待2秒
# time.sleep(2)




# 导包
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 创建浏览器驱动
driver = webdriver.Chrome()
# 获取访问页面
driver.get("http://121.43.169.97:8848/pageA.html")
# 放大浏览器
driver.maximize_window()
time.sleep(1)
# 模拟用户操作
# 获取用户名：包含部分属性值
driver.find_element(By.XPATH, "//*[contains(@placeholder,'密码')]").send_keys("123456789")

# 等待3秒
time.sleep(3)
